'use strict'

module.exports = appInfo => {

    const path = require('path')

    const config = exports = {}

    exports.cluster = {
        listen: {
            port: 7001,
            hostname: '127.0.0.1',
            // path: '/var/run/egg.sock',
        }
    }

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + '_1539219245606_714';

    // add your config here
    config.middleware = [ 'gzip' ];

    // config.view = {
    //     defaultViewEngine: 'nunjucks',
    //     mapping: {
    //         '.tpl': 'nunjucks'
    //     }
    // }

    config.security = {
        csrf: {
            enable: false,
        }
    }

    config.bodyParser = {
        jsonLimit: '1mb',
        formLimit: '1mb'
    }

    config.logrotator = {
        filesRotateByHour: [
            path.join(appInfo.root, 'logs', appInfo.name, 'common-error.log'),
        ],
    }

    exports.jwt = {
        secret: "8582f078-e5b5-418f-96f3-1debecfb190c"
    }

    return config;
};